abstract class BasicButton
{
  int X;
  int Y;
  int W;
  int H;
  int clrFill;
  int clrStroke;
  int id;
  String label;
  
  BasicButton(int id, String label, int X, int Y, int W, int H)
  {
    this.label = label;
    this.id = id;
    this.X = X;
    this.Y = Y;
    this.W = W;
    this.H = H;
    
  }
  
  abstract void draw ();
  
    //Generic function to test pointer in Bounds
  boolean PointerInBounds(int mX, int mY)
  {

    int x = this.X;
    int y = this.Y;
    int w = this.W;
    int h = this.H;
    
    
    int x1 = x + w; 
    int y1 = y + h;
    int temp;
   
    if(y > y1)
    {
      temp = y;
      y = y1;
      y1 = temp;
    }

    if(x > x1)
    {
      temp = x;
      x = x1;
      x1 = temp;    
    }

    return ((mX >= x && mX <= x1) && (mY >= y && mY <= y1));

  }
  
  void setColor(int clr)
  {
    clrFill = clr;
  }
}

class Tab extends BasicButton
{
  Tab(int id, String label, int X, int Y, int W, int H)
  {
    super(id, label, X, Y, W, H);
  }
  
  void draw ()
  {
    /** Graph Text: Center align**/
    textFont(_font, 18);
    roundRect(10, clrStroke, clrFill, 0, X, Y, W, H);
    fill(0xFF000000);
    textAlign(CENTER);
    text(label, X+W/2, Y+H-7);
  }
}

class Button extends BasicButton
{
  Button(int id, String label, int X, int Y, int W, int H)
  {
    super(id, label, X, Y, W, H);
  }
  
  void draw ()
  {
    /** Graph Text: Center align**/
    textFont(_font, 18);
    strokeWeight(1);
    stroke(clrStroke);
    fill(clrFill); 
    rect(X, Y, W, H);
    
    fill(0xFF000000);
    textAlign(CENTER);
    text(label, X+W/2, Y+H-7);
  }
}


